package com.zx.server.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *
 * Description:
 */
@Configuration
public class RabbitMQConfig {

    //声明队列
    @Bean
    public Queue queue_A(){

        return new Queue("identity_queueA");
    }

    @Bean
    public Queue queue_C(){

        return new Queue("identity_queueC");
    }

    @Bean
    public Queue hello(){

        return new Queue("hello");
    }

    //声明交换机
    @Bean
    public TopicExchange exchange(){

        return new TopicExchange("identity_exchange");
    }

    @Bean
    public Binding bindingA(){

        return BindingBuilder.bind(queue_A()).to(exchange()).with("identity.*");
    }

    @Bean
    public Binding bindingC(){
        return BindingBuilder.bind(queue_C()).to(exchange()).with("identity.*");
    }

    @Bean
    public Binding bindingHello(){
        return BindingBuilder.bind(hello()).to(exchange()).with("identity.*");
    }



}
